/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package folders2;

import DlinkedList.MyDList;
import java.io.IOException;

/**
 *
 * @author Administrator
 */
public interface UserFileOperation2Interface {

    /**
     * This method is used to add new user to server
     * @param userFile new userName
     */
    void addNewUser(UsersFile2 userFile);

    /**
     * This method is used to decrement number of sent messages to any user in the server to 0
     * because when he open mail he will receive all sent messages to him
     * @param userId userName
     */
    void decrementMessageCounter(String userId);

    /**
     * This method is used to delete user from server(i.e. from users list and users file)
     * @param userName userName
     */
    void deleteUser(String userName);

    /**
     * This method is used to get users list
     * @return doubly linked list of users
     */
    MyDList getUsers();

    /**
     * This method is used to increment number of sent messages to any user in the server
     * when user sent message to any other user
     * @param userId userName which message will sent to him
     */
    void incrementMessageCounter(String userId);

    /**
     * This method is used to checks if this username exist on server or not
     * @param name user name
     * @param password user password
     * @return result of type integer
     * returns -1 if user doesn't have mail in server
     * else returns number of messages sent to this user
     */
    int mailExist(String name, String password);

    /**
     * This method is used to read users file (in our case i use it to read file at the start of prject )
     * and loaded users informations in users list(loaded objects of users)
     * @throws java.io.IOException
     */
    void readUsersFile() throws IOException;

    /**
     * This method is used to set users list
     * @param users
     */
    void setUsers(MyDList users);

    /**
     * This method is used to write users informations in users file
     * @throws java.io.IOException
     */
    void writeUsersFile() throws IOException;

}
